home *** CD-ROM | disk | FTP | other *** search
- Script Tools
- ====== =====
-
- By
- Keith R. Burby
-
-
- Copyright
-
- These programs, their source code, and this document are placed in the
- public
- domain. As a courtesy, I only ask that when you distribute these files,
- please distribute them in their original un-modified form.
-
-
- Warranty
-
- The author offers no warrantee or accepts any responsibility for the
- consequences of using these programs. Use these programs AT YOUR OWN RISK.
-
-
- So, What are These Tools?
-
- The three programs are Basename, Pathname, and TackOn. Former users of the
- ARP replacement shell will recognize the first and last commands. Basename
- takes a complete path/file name and extracts the base filename and
- optionally strip off a specified suffix as well. TackOn does pretty much
- does the opposite, it takes a pathname and filename and appends the latter
- to the former. Pathname, which is new, will take the complete path/file
- name and extract the pathname.
-
-
- Usage
-
- With all three programs, enter a question mark will, of course, display the
- template.
-
- Program: Basename
- Template: NAME/A,SUFFIX
- Arguments: NAME = Complete path/file name to extract the basename from.
- SUFFIX = Optional suffix to strip off.
- Example: Basename RAM:ScriptTools/Basename.mod .mod
- Returns: Basename
-
- Program: TackOn
- Template: PATH/A,FILE/A
- Arguments: PATH = Name of path to be appended to.
- FILE = Filename to append to the path.
- Example: TackOn RAM:ScriptTools TackOn.mod
- Returns: RAM:ScriptTools/TackOn.mod
-
- Program: Pathname
- Template: NAME/A
- Arguments: NAME = Complete path/file name to extract the pathname from.
- Example: Pathname RAM:ScriptTools/Pathname.mod
- Returns: RAM:ScriptTools
-
- All three programs require AmigaDOS 2.0 or better and are pure and can be
- made resident.
-
-
- So, What Good are These Programs?
-
- These programs were designed to be primarily used inside a script file, or
- more specifically, within back-quotes (``) to send their information to
- another command's command line. Here's an example, albeit pointless,
-
- script to show these tools in action.
-
- .key Fullname/A,Destination/A
-
- CD "`Pathname <Fullname>`"
-
- Set Basename "`Basename <Fullname>`"
- Set Barename "`Basename <Fullname> .mod`"
-
- If exists "$Barename"
- Copy "$Barename" to "<Destination>"
- EndIf
-
- If exists "$Basename"
- Copy "$Basename" to "`TackOn "<Destination>" "$Barename"`.mud"
- Else
- Echo "Couldn't find $Basename."
- Quit 10
- EndIf
- Quit 0
-
- This script simply copies a Modula/Oberon source file to the destination
- directory, changing the suffix to ".mud" and copies the binary file, if it
- exists, to the destination directory. (I tool you it was pointless. :>)
-
-
- What These Programs Don't Do.
-
- These programs don't check if the specified file or path actually exist.
- AmigaDOS already provides those capabilities.
-
- Nor do these programs check if the specified path or file names are proper
- names. If you specify a path with a dozen subdirectories or a filename
- with over the legal 32 characters (OS2.x's command line can be up to 512
- characters long), these programs will work with them, but I make no
- guarantees as to what their result will be.
-
-
- Finally,
-
- If you have any suggestions, comments, bug reports, flames (go easy on me,
- this is my first time :>), or whatever, I can be reached, via mail, at:
-
- Keith R. Burby
- 3800 Teeple Lake Road
- White Lake, MI 48383-3141
- USA
-
- or via E-Mail at:
-
- kb0s2113@sycom.mi.org
- or
- Arcane@lppl.mi.org
-
- As always.
- K/B
- ~~~
-